import Vue from 'vue'
import VueRouter from 'vue-router'
import home from "../components/home.vue"
import login from "../components/login.vue"
import index from "../components/index.vue"
import indexproduct from "../components/indexproduct.vue"
import register from "../components/register.vue"
import allproducts from "../components/allproducts.vue"
import repassword from "../components/repassword.vue"
import personal from "../components/personal.vue"
import personalinfo from "../components/personalinfo.vue"
import mygoods from "../components/mygoods.vue"
import myorder from "../components/myorder.vue"
import classification from "../components/classification.vue"
import gooddetail from "../components/gooddetail.vue"
import test2 from "../components/test2.vue"
import VueCookies from 'vue-cookies'
Vue.use(VueCookies)
Vue.use(VueRouter)

const routes = [
  { path: '/',
    component : index,
    name: 'index',
    redirect:'/home/indexproduct',
    children:[
      {
        path:'home',
        component:home,
        children:[
          {
            path:'allproducts',
            name:'allproducts',
            component:allproducts
          },
          {
            path:'indexproduct',
            name:'indexproduct',
            component:indexproduct
          },
          {
            path:'classification',
            name:'classification',
            component:classification
          },
          
        ]

      },

    ] },
    {path:'/login',
    name:'login',
    component:login
    },
    {path:'/register',
    name:'register',
    component:register
    },
    {path:'/repassword',
    name:'repassword',
    component:repassword
    },
    {path:'/personal',
    name:'personal',
    component:personal,
    redirect:'/personal/personalinfo',
    children:[{
      path:'personalinfo',
      name:personalinfo,
      component:personalinfo
    },
    {
      path:'myorder',
      name:myorder,
      component:myorder
    },
    {
      path:'mygoods',
      name:mygoods,
      component:mygoods
    },
  ]
    },
    {path:'/gooddetail',
      name:'gooddetail',
      component:gooddetail
    },
    {path:'/test2',
    	name:'test2',
        component:test2}

    
   
]

const router = new VueRouter({
  routes,
  mode:"history"
})

export default router
